<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
  let obj = {
    name:"ykk",
    age:18,
    result:{
      a:1,
      b:2
    }
  }
  // function clone(obj){
  //   let target = Array.isArray(obj)?[]:{}
  //   if(typeof obj === 'object'){
  //     for (const key in obj){
  //        target[key] = clone(obj[key])
  //     }
  //     return target
  //   }else{
  //     return obj
  //   }

  // }
  // let result = clone(obj);
  // console.log(result)
// for in 是对象的键值对
for(const key of obj){
  console.log(key,obj)
}

  </script>
</body>
</html>